import { source } from '../services/component';


export default {

  namespace: 'mydjcard',

  state: {

  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(({pathname, query}) => {
        if (pathname.toString() == "/selfinfo/mycard") {
          dispatch({type: 'basicInfo'});
        }
        if (pathname.toString() == "/selfinfo/myweb") {
          dispatch({type: 'responsible'});
        }
      })
    }
  },

  effects: {
    //基本信息
    *basicInfo({payload}, { call, put, select }) {

      console.log('基本信息');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

    //组织信息
    *orgInfo({payload}, { call, put, select }) {

      console.log('组织信息');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

    //发挥作用
    *playRole({payload}, { call, put, select }) {

      console.log('发挥作用');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

    //负责网站
    *responsible({payload}, { call, put, select }) {

      console.log('负责网站');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },



  },

  reducers: {
    success(state, action){
      return {...state, ...action.payload};
    }
  }
};
